//
//  helpViewController.m
//  NewMyMusicAPP
//
//  Created by 11_wyq on 15/7/3.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "helpViewController.h"

@interface helpViewController ()

@end

@implementation helpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blackColor];
    
    UIImage *image2 = [UIImage imageNamed:@"VList_Left@2x.png"];
    image2 = [image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:image2 style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    
    
    //       给导航栏上放自定义label
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0,  WIDTH * 100, HEIGHT * 30)];
    [view setBackgroundColor:[UIColor clearColor]];
    self.navigationItem.titleView = view;
    UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH * 10, 0, WIDTH * 100, HEIGHT * 30)];
    title.text = @"关于我们";
    title.textColor = [UIColor whiteColor];
    [title setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];//加粗字体
    [view addSubview:title];
    
    
    
    if (self.number == 1) {
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, 340, 200)];
        [label.text setFont:[UIFont fontWithName:@"Helvetica-Bold" size:17]];//加粗字体
        label.textColor = [UIColor whiteColor];
        label.text = @"听点什么 For IPhone\n \n听点什么,是一个致力于为广大音乐爱好者提供高清MV以及高品质音乐视频在线观看的一款APP,该APP的成长离不开大家的关注与支持,希望大家多和我们交流,多提一些意见,让我们有更好的改进";
        label.numberOfLines = 0;
        [self.view addSubview:label];
        
    }
    
    
    if (self.number == 2) {
        
        title.text = @"帮助指南";
        self.myScrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
        [self.view addSubview:self.myScrollView];
        self.myScrollView.contentSize = CGSizeMake(MYWIDTH * 5, 0);
        //翻页显示
        self.myScrollView.pagingEnabled = YES;
        //禁止边界反弹效果
        self.myScrollView.bounces = NO;
        //下方的滑动条
        self.myScrollView.showsHorizontalScrollIndicator = NO;
        
        //for循环 添加图片
        for (int i = 1; i < 6; i++) {
            UIImageView *imageV = [[[UIImageView alloc] initWithFrame:CGRectMake(MYWIDTH * (i - 1), - 5, MYWIDTH + 2, MYHEIGHT - 58)]autorelease];
            NSString *string = [NSString stringWithFormat:@"help%d",i];
            NSLog(@"name = %@",string);
            NSString *name = [[NSBundle mainBundle] pathForResource:string ofType:@"png"];
            imageV.image = [UIImage imageNamed:name];
            [self.myScrollView addSubview:imageV];
            self.myScrollView.delegate = self;
        }
        
        
        
        //设置下方的小点点
        self.pagC = [[[UIPageControl alloc] initWithFrame:CGRectMake(115 * WIDTH, 575 * HEIGHT, 150, 20)]autorelease];
        self.pagC.backgroundColor = [UIColor clearColor];
        [self.view addSubview:self.pagC];
        //设置四个点点
        self.pagC.numberOfPages = 5;
        self.pagC.currentPageIndicatorTintColor = [UIColor orangeColor];//滑动到那里变成橘色
        self.pagC.pageIndicatorTintColor = [UIColor whiteColor];
        
        //点击点点  触发的方法
        [self.pagC addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventValueChanged];
        

        
        
        
        
        
        
        
        
        
        
        
        
        
    }
    
    
    
    
   
}



-(void)pageAction:(UIPageControl *)page
{
   
    NSLog(@"点击下方小点点, 控制图片");
    [self.myScrollView setContentOffset:CGPointMake(MYWIDTH * self.pagC.currentPage+1, 0) animated:YES];
    
    NSString *string = [NSString stringWithFormat:@"第%ld页",(long)self.pagC.currentPage + 1];
    self.navigationItem.title = string;
    
}


-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
  
    NSLog(@"点击图片控制 小点点");
    self.pagC.currentPage = self.myScrollView.contentOffset.x / MYWIDTH ;
    
    NSString *string = [NSString stringWithFormat:@"第%ld页",(long)self.pagC.currentPage + 1];
    self.navigationItem.title = string;
    
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
